/**
 * 
 * 
 */
 import { _decorator, Component, Node, Label, Sprite, SpriteFrame, Color } from 'cc';
import { Esuit } from './ConfigEnum';
import { Poker } from './Poker';
 
const  Point_map=
{
  "1":"1",
  "2":"2",
  "3":"3",
  "4":"4",
  "5":"5",
  "6":"6",
  "7":"7",
  "8":"8",
  "10":"10",
  "11":"J",
  "12":"Q",
  "13":"K",
}
 const { ccclass, property } = _decorator;
 
 @ccclass('UIPoker')
 export class UIPoker extends Component{
     
     @property(Label) public pointLaber:Label=null;
     @property(Sprite) public SmallSuitSprite:Sprite=null;
     @property(Sprite) public BigSuitSprite:Sprite=null;

     @property(SpriteFrame) texFrontBG:SpriteFrame=null;
     @property(SpriteFrame)  texBackBG:SpriteFrame=null;
     @property(SpriteFrame) BigSuit:SpriteFrame[]=[]
     @property(SpriteFrame) SmallSuit:SpriteFrame[]=[];
     @property(SpriteFrame) texFaces:SpriteFrame[]=[];


     private redTextColor:Color=Color.RED;
     private blackTextColor: Color=Color.BLACK;

    
     public Init(poker:Poker)
     {
           //this.laber_.string=' (点数: ${poker.point_} 花色: ${poker.suit_} )';
          // this.laber_.string='(${poker.point_}, ${poker.suit_})';
          //this.pointLaber.string='(点数:' +poker.point_+ '花色'+ poker.suit_ +')';
          this.pointLaber.color=(poker.suit_==Esuit.heitao||poker.suit_==Esuit.meihua)?this.blackTextColor:this.redTextColor;
          this.pointLaber.string=Point_map[poker.point_];
          if(poker.point_>=11)
          {
            this.BigSuitSprite.spriteFrame=this.texFaces[poker.point_-11]
          }else{
            this.BigSuitSprite.spriteFrame=this.BigSuit[poker.suit_];
          }
         
          this.SmallSuitSprite.spriteFrame=this.SmallSuit[poker.suit_];
     }
 
 }
 